<!doctype html>
<html lang="en">

<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover" />
    <meta http-equiv="X-UA-Compatible" content="ie=edge" />
    <title>{{.Title}} - 小牧童</title>
    <link rel="preconnect" href="https://fonts.gstatic.com/" crossorigin>
    <meta name="msapplication-TileColor" content="#206bc4" />
    <meta name="theme-color" content="#206bc4" />
    <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
    <meta name="apple-mobile-web-app-capable" content="yes" />
    <meta name="mobile-web-app-capable" content="yes" />
    <meta name="HandheldFriendly" content="True" />
    <meta name="MobileOptimized" content="320" />
    <meta name="robots" content="noindex,nofollow,noarchive" />
    <link rel="icon" href="/favicon.ico" type="image/x-icon" />
    <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />

    <link href="/static/comp/bootstrap/css/bootstrap.min.css" rel="stylesheet" />
    <script src="/static/comp/bootstrap/js/bootstrap.bundle.min.js"></script>
    <script src="/static/comp/jquery/jquery.min.js"></script>
    <style>
        body {
            display: none;
        }
    </style>
</head>

<body>
    <nav id="layout_top" class="navbar navbar-expand-lg navbar-light bg-primary">
        <div class="container-xl">
            <a class="navbar-brand text-light" href="/stocks">
                <img src="/static/img/stocks.png" alt="" width="32" height="32" class="d-inline-block">
                <span style="margin-left: 12px;">小牧童</span>
            </a>

            <button class="navbar-toggler" type="button" data-bs-toggle="collapse"
                data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false"
                aria-label="Toggle navigation">
                <span class="navbar-toggler-icon"></span>
            </button>

            {{ if .IsLogin }}
            <div class="collapse navbar-collapse" style="flex-direction: row-reverse; flex-grow: 0;"
                id="navbarSupportedContent">

                <ul class="navbar-nav me-auto mb-2 mb-lg-0">
                    <!-- <li class="nav-item">
                        <a class="nav-link text-light" aria-current="page" href="/">网站首页</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link text-light" aria-current="page" href="/stocks">主要指数</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link text-light" aria-current="page" href="/stocks/today">今日行情</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link text-light" href="/stocks/weigh/index">指数分析</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link text-light" href="/stocks/calendar">投资日历</a>
                    </li> -->
                    <li class="nav-item dropdown">
                        <a class="nav-link dropdown-toggle text-light" href="#" id="navbarDropdown" role="button"
                            data-bs-toggle="dropdown" aria-expanded="false">
                            {{ .NickName }}
                        </a>
                        <ul class="dropdown-menu" aria-labelledby="navbarDropdown">
                            <!-- <li><a class="dropdown-item" href="#"></a></li>
                            <li><a class="dropdown-item" href="#">Another action</a></li> -->
                            <!-- <hr class="dropdown-divider"> -->
                            <li><a class="dropdown-item" href="/pub/logout">退出登录</a></li>
                        </ul>
                    </li>

                </ul>
            </div>

            {{ else }}
            <div class="collapse navbar-collapse" style="flex-direction: row-reverse;" id="navbarSupportedContent">
                <a class="text-light" href="/pub/login">登录</a>
            </div>
            {{ end }}

        </div>
    </nav>

    <div class="container-xl my-2">
        {{ yield }}
    </div>

    <a id="backtotop" href="#layout_top" style="position: fixed; bottom: 20px; right: 20px; display: none;">
        <img src="/static/img/back_to_top.png " title="返回顶部" width="64" height="64" />
    </a>

    <footer class="footer py-4">
        <div class="container">
            <div class="row align-items-center">
                <div class="col-lg-4 text-lg-start">Copyright &copy; CHENRH.COM <a href="https://beian.miit.gov.cn/"
                        class="ml-2 text-muted" target="_blank">浙ICP备17002668号-1</a></div>
                <div class="col-lg-4 my-3 my-lg-0">
                </div>
                <div class="col-lg-4 text-lg-end">
                </div>
            </div>
        </div>
    </footer>

    <script>
        window.onscroll = function () {
            if (document.body.scrollTop > 20 || document.documentElement.scrollTop > 20) {
                document.getElementById("backtotop").style.display = "block";
            } else {
                document.getElementById("backtotop").style.display = "none";
            }
        };
        document.body.style.display = "block"
    </script>
</body>

</html>